package com.viptail.xiaogouzaijia.view.fragments;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.hannesdorfmann.mosby.mvp.MvpBasePresenter;
import com.hannesdorfmann.mosby.mvp.MvpPresenter;
import com.viptail.xiaogouzaijia.R;
import com.viptail.xiaogouzaijia.api.ExceptionHandle;
import com.viptail.xiaogouzaijia.view.activyty.SettingActivity;
import com.viptail.xiaogouzaijia.view.activyty.UserActivity;
import com.viptail.xiaogouzaijia.view.activyty.WalletActivity;
import com.viptail.xiaogouzaijia.view.base.BaseFragment;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * A simple {@link Fragment} subclass.
 */
public class MyFragment extends BaseFragment {

    @BindView(R.id.image_user)
    ImageView imageUser;
    @BindView(R.id.my_wallet)
    RelativeLayout myWallet;
    @BindView(R.id.image_setting)
    ImageView imageSetting;

    public static MyFragment newInstance() {

        Bundle args = new Bundle();

        MyFragment fragment = new MyFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_my;
    }

    @Override
    public void initView() {

    }

    @Override
    public void initData() {

    }

    @Override
    public MvpPresenter createPresenter() {
        return new MvpBasePresenter();
    }

    @Override
    public void onSuccess(Object o) {

    }

    @Override
    public void onFail(ExceptionHandle.ResponeThrowable e) {

    }

    @Override
    public void onFinish() {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        ButterKnife.bind(this, rootView);
        return rootView;
    }

    @OnClick({R.id.image_user, R.id.my_wallet, R.id.image_setting})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.image_user:
                Intent intent1 = new Intent(getActivity(), UserActivity.class);
                startActivity(intent1);
                break;
            case R.id.my_wallet:
                Intent intent2 = new Intent(getContext(), WalletActivity.class);
                startActivity(intent2);
                break;
            case R.id.image_setting:
                Intent intent3 = new Intent(getContext(),SettingActivity.class);
                startActivity(intent3);
                break;
        }
    }
}
